package jdbc_practice;

import java.sql.*;

public class RegDemo {
    public static void main(String[] args) {

        try(Connection connection = DBUtil.getConnection();) {
            Statement statement = connection.createStatement();
            String sql = "INSERT INTO user(username, password, nickname, age)\n" +
                    "VALUES (username = ?,password = ?,nicknameage = ?)";
            PreparedStatement ps = connection.prepareStatement(sql);
            ps.setString(1,"赵六");
            ps.setString(2,"666666");
            ps.setString(3,"老六");
            ResultSet rs = ps.executeQuery();
            if(rs.next()){
                System.out.println("登录成功");
            }else{
                System.out.println("登录失败");

            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
